<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <meta http-equiv="X-UA-Compatible" content="ie=edge" />
  <title>Document</title>
</head>

<body>
  <button>得到所有的省份数据</button>
  <script>
    let req;

    function getRequestInfo() {
      if (!req) {
        const url = 'http://study.yuanjin.tech/api/local';
        req = new Request(url, {});
        console.log(req);
      }
      return req.clone(); //克隆一个全新的request对象，配置一致
    }

    async function getProvinces() {
      const resp = await fetch(getRequestInfo());
      const result = await resp.json();
      console.log(result);
    }

    document.querySelector('button').onclick = function () {
      getProvinces();
    };
  </script>
</body>

</html>